import java.util.Scanner;

public class J6_2_3 {
    //递归求 N 的阶乘
    public static void main(String[] args) {
        System.out.println("请输入n");
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int factorial = factorial(n);
        System.out.println("n的阶乘为"+ factorial);
    }
    public static int factorial(int n) {
        if (n == 1)
            return 1;
        else
            return n * factorial(n - 1);
    }
}
